<template>
<!-- #ifdef APP-PLUS -->
<cell>
<!-- #endif -->
<view class="subject-item sec-top"
	@click="onItemClick">
	<view class="subject-item-header">
		<view class="subject-item-left">{{ item.startTime }}</view>
	</view>
	<view class="subject-item-body">
		<image class="subject-item-cover"
			:src="item.cover && item.cover.middle || ''"
			mode="aspectFill" />
		<view class="subject-item-info">
			<view class="subject-item-summary sec-left">
				<view class="subject-title line-clamp-1">{{ item.title }}</view>
				<view class="subject-subtitle line-clamp-2">{{ item.subtitle }}</view>
			</view>
			<view class="subject-item-author sec-left">
				<text>{{ item.teachers[0].nickname }}</text>
				<text class="sec-left">讲师</text>
			</view>
		</view>
	</view>
	<view class="subject-item-footer">
		<view class="subject-item-left">
			<text class="subject-item-book">{{ item.hitNum }}</text>
			<text class="sec-left">人预约</text>
		</view>
		<view class="subject-item-right">
			<button class="btn btn-primary"
				@click.stop="onItemBook">预约</button>
		</view>
	</view>
</view>
<!-- #ifdef APP-PLUS -->
</cell>
<!-- #endif -->
</template>

<script>
export default {
	props: {
		item: {
			type: Object,
			default: () => {}
		}
	},
	methods: {
		onItemClick() {
			this.$emit('detail');
		},
		onItemBook() {
			this.$emit('@book');
		}
	}
}
</script>
